import React, { Component } from 'react';
import {
  AppRegistry,
} from 'react-native';
import { StackNavigator } from 'react-navigation'
import ViewOne from './src/ViewOne'
import ViewTwo from './src/ViewTwo'
import ViewThree from './src/ViewThree'

var FirstRouter = "";

export default class Main extends React.Component {

  constructor(props) {
    super(props);
    var FirstRouter = props.FirstRouter;
    alert(FirstRouter);
    console.log(FirstRouter);
  }
  
  render() {

    var RouterConfig = {
      FirstRouter: { screen: ViewOne },
      One: { screen: ViewOne },
      Two: { screen: ViewTwo },
      Three: { screen: ViewThree }
    }

    var FirstRouter = FirstRouter || "One";
    if (RouterConfig.hasOwnProperty(FirstRouter)) {
      RouterConfig.FirstRouter = RouterConfig[FirstRouter];
    }

    const App = StackNavigator(RouterConfig);

    return (
      <App />
    )
  }

}


AppRegistry.registerComponent('MyApp', () => Main);
